package com.sand.util;

import com.sand.entity.TAuthorityEntity;
import org.junit.Test;

import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class helloTag {
/**
 *
 *
 * @author <achao1441470436@gmail.com>
 * @since 2021/9/9/009 15:22
 */
    public static boolean dowCheck(List<TAuthorityEntity> a, Long id){
        if(a!=null && a.size()>0){
            for (TAuthorityEntity auth : a) {
                if(auth.getRid()==id.longValue()){
                    return true;
                }
            }
//            a.forEach(e->{
//                if(e.getId()==id.longValue()) return "checked='checked'";
//            });
        }
        return false;
    }

    public static Boolean allow(Set<TAuthorityEntity> a, Integer id){
        if(a!=null && a.size()>0){
            Iterator<TAuthorityEntity> it = a.iterator();
            while (it.hasNext()){
                TAuthorityEntity auth = it.next();
                if(auth.getRid()==id.longValue()){
                    return true;
                }
            }
        }
        return false;
    }
}
